package com.disc.controller;

import com.disc.baidu.BaiduUser;
import com.disc.common.DiscResponse;
import com.disc.service.DiscService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * Created by Tonight on 2017/7/18.
 */
@RestController
@RequestMapping("/")
public class DiscController {

    @Autowired
    DiscService discServiceImpl;

    /**
     * 百度登陆
     * @param baiduUser
     * @param session
     * @return
     */
    @RequestMapping("baiduLogin")
    public DiscResponse loginBaidu(BaiduUser baiduUser, HttpSession session)
    {
        return discServiceImpl.loginBaidu(baiduUser,session);
    }



    /**
     * 天翼登陆
     * @param baiduUser
     * @param session
     * @return
     * TODO 验证码问题
     */


    @RequestMapping("tianYiLogin")
    public DiscResponse tianYiLogin(BaiduUser baiduUser, HttpSession session)
    {
        return discServiceImpl.loginTianYi(baiduUser,session);
    }

    /**
     *  天翼云获取网盘数据
     * @param fileid
     * @param account
     * @return
     */
    @RequestMapping("getFileDownloadUrl")
    public  DiscResponse getFileDownloadUrl(String fileid, String account)
    {
        return  discServiceImpl.getTianYiFileDownloadUrl(fileid,account);
    }

    /**
     *  天翼云获取单文件下载链接
     * @param fileid
     * @param account
     * @return
     */
    @RequestMapping("getSingleTianYiFileDownloadUrl")
    public  DiscResponse getSingleTianYiFileDownloadUrl(String fileid, String account)
    {
        return  discServiceImpl.getSingleTianYiFileDownloadUrl(fileid,account);
    }
}
